

import java.util.Date;
import java.util.TimerTask;

public class TestTimerTask  extends TimerTask{
	private int num;
	
	public TestTimerTask(int i) {
		this.num=i;
	}

	public void run() {
		try{	
			System.out.println(DateUtil.getStringDate(new Date(), "yyyy-MM-dd HH:mm:ss")+"\t task "+num+" is running!");
			int sum=0;
			for(int i=1;i<20;i++){
				sum+=i;
				Thread.sleep(500);
			}
			System.out.println(DateUtil.getStringDate(new Date(), "yyyy-MM-dd HH:mm:ss")+"\t task "+num+" finished!");
//			System.gc();
		} catch (Exception e) {
			System.err.println(DateUtil.getStringDate(new Date(), "yyyy-MM-dd HH:mm:ss"));
			e.printStackTrace();
			
		}
	}
}	
